package cn.edu.scau.cmi.chenyaoquan.abstractFactoryMethod;


import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class AbstractFactoryController {
	
	  @FXML
	    private TextField meatTextField;

	    @FXML
	    private TextArea meatTextArea;

	    @FXML
	    private TextField brandTextField;

	    @FXML
	   public  void getMeat(ActionEvent event) {

	BrandFactory bf = BrandFactory.getMeatFactory(brandTextField.getText());
	
	if(meatTextField.getText().equals("pork")) {
		Pork  pork = bf.getPork();
		meatTextArea.appendText(pork.getPorkInfo());
	}
	if(meatTextField.getText().equals("beef")) {
		Beef  beef = bf.getBeef();
		meatTextArea.appendText(beef.getBeefInfo());
	}
	if(meatTextField.getText().equals("chicken")) {
		Chicken  chicken = bf.getChicken();
		meatTextArea.appendText(chicken.getChickenInfo());
	}
}
}